/*@ File Name : vertexobjectbuffer.h
  @ Date : 18/11/2011
  @ Author : Guillaume Collombet, Ulysse Mensa, Sylvain Chambe

Fireworks simulation projet
Copyright (C) 2011 Guillaume Collombet, Ulysse Mensa, Sylvain Chambe

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

You can contact us by sending mail at fireworks-simulation-project@googlecode.com*/

#if !defined(_VERTEXOBJECTBUFFER_H)
#define _VERTEXOBJECTBUFFER_H

#ifdef _WIN32
	#include <Windows.h>
#endif

#include <GL/glew.h>
#include <stdio.h>

#define BUFFER_OFFSET(a) ((char*)NULL + (a))

enum e_VBO_MEMBERS
{
	VBO_MEMBERS_VERTEX = 0x1,
	VBO_MEMBERS_COLOR = 0x2,
	VBO_MEMBERS_NORMAL = 0x4,
	VBO_MEMBERS_TEXCOORD = 0x8,
	VBO_MEMBERS_EDGE = 0x10
} typedef VBO_MEMBERS;

struct s_VBO
{
	GLuint id;
	float* vertex;
	float* color;
	float* normal;
	float* texCoord;
	float* edge;
	int vertexCount;
	int colorCount;
	int textureCount;
	int edgeCount;
	int count;
	VBO_MEMBERS members;
} typedef VBO;

void VBO_Init(VBO* vbo, VBO_MEMBERS flags, int lenght,	int vertexCount, int colorCount, int textureCount, int edgeCount);
void VBO_setVertex(VBO* vbo, const float* data, int index);
void VBO_setColor(VBO* vbo, const float* data, int index);
void VBO_setNormal(VBO* vbo, const float* data, int index);
void VBO_setTexture(VBO* vbo, const float* data, int index);
void VBO_setEdge(VBO* vbo, const float* data, int index);
void VBO_Update(const VBO* vbo, VBO_MEMBERS flags);
void VBO_DrawAll(const VBO* vbo, VBO_MEMBERS flags, GLuint mode);
void VBO_Draw(const VBO* vbo, VBO_MEMBERS flags, GLuint mode, int start, int count);
void VBO_Destroy(VBO* vbo);

#endif /*_VERTEXOBJECTBUFFER_H*/